package com.likerSai;

/**
 * 回文数
 *
 * @author sun.ye
 * @since 2021-04-28 17:39
 */
public class IsPalindrome {
    public static void main(String[] args) {
        isPalindrome(121);
    }

    public static boolean isPalindrome(int x){

        if (x < 0) {
            return false;
        }
        char[] chars = String.valueOf(x).toCharArray();
        for (int i = 0; i < chars.length / 2 ;i++){
            if (chars[i] != chars[chars.length - i]){
                return false;
            }
        }
        return true;


    }
}